Skip to content

A Bot can read a large attached file to its end - #2876

Open
davidmckayv wants to merge 2 commits into
mainfrom
read-whole-attachments
Open

davidmckayv wants to merge 2 commits into
mainfrom
read-whole-attachments

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

A large text file reached a Bot as its first 120,000 characters, with no way to read the rest. A customer's 267 to 500 KB text files reached their connected Bot cut off, and the composer warned "may be cut". The server now offers every Bot a read_attachment tool, over plain AG-UI tools, that reads an attached file of the conversation page by page. This PR has the tool's name, how the conversation draws it, and the composer's warning:

  • shared: the tool's name (shared/read-attachment.ts) and its step words, "Reading an attached file" / "Read an attached file".
  • Conversation: a run of reads of one file is drawn as one row naming the file and how many parts ("survey-export.txt, in 8 parts"). The folded line counts it as one file read. The row doesn't open to the text, which is the person's own file.
  • API: deployment gains an optional attachmentsReadWhole (additive response field; absent means false). The app shows the feature only when the server says so.
  • Composer: where the server says attachmentsReadWhole: true, a large text file's tile drops " · may be cut", because the Bot reads the whole file. Against an older server the warning stays exactly as it was. The tile's design doesn't change; the size line just loses the suffix.

API checklist (docs/api-and-migrations.md): read; nothing removed, renamed or tightened; the new field is optional in an answer; bun run api:generate run and committed with sources, bundle and clients; oasdiff breaking against main reports no breaking changes; bun run api:lint clean.

Red/green

  • app/tests/composer-attachments-ui.test.tsx, "does not warn on a large text file when the server's Bots read the whole file": red with the composer's !readsWhole && taken out (Received: "notes.txt117KB · may be cutAsk anything"), green with it.

  • app/tests/attachment-read-steps.test.tsx: three reads of one file draw as one row, "Read an attached file · survey-export.txt, in 3 parts", under "Read 1 file"; while a part is being read the line says "Reading an attached file…".

  • app/tests/attachment-read-steps.test.tsx, "one read on a line of its own names the file it read": found in the end-to-end run below (the line read "Read an attached file" with a wrench and no file). Red before the fix (Received: "Read an attached file"), green after.

End to end: Chrome and Safari

The real product on a throwaway box, with a stock Claude Agent SDK AG-UI agent (the AG-UI repository's own example, unmodified) on the real model, in Chromium and in WebKit. A person attaches a 500 KB .txt and asks for its last line. Before is main; after is this branch.

  • Before, in both browsers: the tile says "500KB · may be cut". The Bot calls no tool and answers 003629,pa, a line cut off at the 120,000th character.
  • After, in both browsers: the tile shows the size alone. The Bot calls read_attachment near the end of the file, the step reads "Read an attached file · survey-export.txt", and it quotes THE LAST LINE: survey closed with 412 parcels exactly. The tile and the step use the existing components and tokens, and nothing else on either screen changed.
Before After
Chromium, attached
Chromium, answered
WebKit, attached
WebKit, answered

Where it runs

  • New state that outlives a request? None.
  • What happens on the second replica? Nothing new: the composer reads one more field of deployment.
  • Anything serialised? One new optional boolean in the deployment answer.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No.

API and database

  • Read docs/api-and-migrations.md. One new optional response field, attachmentsReadWhole on deployment. Nothing removed, renamed or tightened. No database change and no release-policy.json change.

Changelog

API.

  • deployment has a new optional attachmentsReadWhole: whether a Bot can read the whole of an attached text file or document, page by page, past the first 120,000 characters.

Web app and OpenBot Desktop.

  • Large attached files. A Bot can read the whole of a large attached text file or document, and the composer no longer warns that such a file "may be cut" when the server says its Bots read the whole file. A Bot's reads show in the conversation as "Read an attached file", one row per file.

@davidmckayv
davidmckayv force-pushed the read-whole-attachments branch from 4142ad3 to f27ee31 Compare December 3, 2026 16:25
@davidmckayv
davidmckayv marked this pull request as ready for review December 3, 2026 17:01
A large text file reached a Bot as its first 120,000 characters, with no way
to read the rest, and the composer warned the file "may be cut". The server
now offers every Bot a read_attachment tool that reads an attached file page
by page. This has its name, how the conversation draws it, and the warning.

- shared: the tool's name (read-attachment.ts), and its step words: "Reading
  an attached file" / "Read an attached file".
- The conversation draws a run of reads of one file as one row naming the
  file and how many parts, and the folded line counts it as one file read.
- API: deployment gains an optional attachmentsReadWhole. Where a server says
  true, the composer drops the "may be cut" warning, since the Bot reads the
  whole file. Absent, as from an older server, the warning stays as it was.
Found in the end-to-end run: a Bot that read only the end of a file made one read, drawn on a line of its own, and the line said "Read an attached file" with a wrench and no file. It now names the file the answer carries and draws a file, as the folded row does.
@davidmckayv
davidmckayv force-pushed the read-whole-attachments branch from 5601f84 to 5cebb73 Compare December 3, 2026 17:38

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant